package com.hoshiibuy.es.service.impl;

import com.hoshiibuy.es.entity.Student;
import com.hoshiibuy.es.repository.StudentRepository;
import com.hoshiibuy.es.service.StudentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

//定义学生信息服务接口实现类
@Service("studentService")
public class StudentServiceImpl implements StudentService {

    @Resource(name = "studentDao")
    private StudentRepository studentDao;

    //添加学生信息
    @Override
    public void addStudent(Student student) {
        studentDao.addStudent(student);
    }

    //批量添加学生信息
    @Override
    public void batchAddStudent(List<Student> students) {
    studentDao.batchAddStudent(students);
    }

    //根据学生姓名查询学生信息
    @Override
    public List<Student> queryStudentsByName(String studentName) {
        return studentDao.queryStudentByName(studentName);
    }

    //创建es索引
    @Override
    public void createIndex() {
        studentDao.createIndex();
    }
}